cmake_minimum_required (VERSION 3.8)

#project(sqlite3xx)

include_directories("../wolfssl/wolfssl")
include_directories("../wolfssl")

link_directories("../wolfssl")

# sqlite
add_definitions(-DSQLITE_HAS_CODEC)
add_definitions(-DSQLITE_TEMP_STORE=3)
add_definitions(-DSQLITE_ENABLE_COLUMN_METADATA)
add_definitions(-DSQLITE_ENABLE_UNLOCK_NOTIFY)
add_definitions(-DSQLITE_CORE=1)
add_definitions(-DSQLITE_AMALGAMATION=1)

#wolfssl
add_definitions(-DWOLFSSL_LIB)
add_definitions(-DWOLFSSL_USER_SETTINGS)
add_definitions(-DCYASSL_USER_SETTINGS)
add_definitions(-DWOLFSSL_IGNORE_FILE_WARN)
add_definitions(-DSSL_SNIFFER_EXPORTS)
#add_definitions(-DHAVE_FIPS)
#add_definitions(-D_MSC_VER)
#add_definitions(-DWOLFSSL_SGX)


#add_definitions(-DOPENSSL_EXTRA)


IF(CMAKE_BUILD_TYPE MATCHES "Debug" AND WIN32)
	add_definitions(-D__DEBUG__)
	add_definitions(-D__WIN32__)
	add_definitions(-D_LIB)
ELSEIF((CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") AND WIN32)
	add_definitions(-D__WIN32__)
	add_definitions(-D_LIB)
ELSEIF(CMAKE_BUILD_TYPE MATCHES "Debug" AND UNIX)
	add_definitions(-D__DEBUG__)
	add_definitions(-D__LINUX__)
	add_definitions(-fpermissive)
ELSEIF((CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") AND UNIX)
	add_definitions(-D__LINUX__)
	add_definitions(-fpermissive)
ENDIF()


#file(GLOB sqlite3xx_srcs "*.c" "*.cpp")
#file(GLOB sqlite3xx_srcs "sqlite3.c" "sqlite3xx.cpp" "crypto.c")
file(GLOB sqlite3xx_srcs "sqlite3.c" "sqlite3xx.cpp" "crypto_openssl.c")
file(GLOB wolfssl_srcs "../wolfssl/wolfcrypt/src/*.c*" "../wolfssl/src/*.c")
#add_library(sqlite3xx STATIC ${sqlite3xx_srcs} $<TARGET_OBJECTS:wolfssl>)
add_library(sqlite3xx_objs OBJECT ${sqlite3xx_srcs} ${wolfssl_srcs})
add_library(sqlite3xx STATIC $<TARGET_OBJECTS:sqlite3xx_objs>)
